Repository navigation
Jackknife uncertainty estimates for subspaceid - #215
Open
baggepinnen wants to merge 2 commits into
Open
baggepinnen wants to merge 2 commits into
baggepinnen wants to merge 2 commits into
Conversation
subspaceid(data, nx; uncertainty = Val(:jackknife), nblocks) returns the model together with a SubspaceJackknife object holding one estimate per left-out block of data matrix columns, transformed to the state basis of the full-data model through the extended observability matrix. jackknife_std, jackknife_cov and pole_std compute standard deviations and covariances from these replicates. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Normalize the residual covariance in find_PK by the number of data matrix columns; Q, R, S and P previously grew linearly with the record length. - Honor stable = false (eigenvalue reflection was applied unconditionally). - Assign the samples before the first and after the last Hankel column to the first and last block, so that the blocks partition the record. - Detect replicates whose observable subspace differs from the full-data model (smallest principal-angle cosine below 0.5), keep them in their own basis, warn, and record this in SubspaceJackknife.aligned; jackknife_cov(unc) throws in that case. - Support covariance-type weight matrices in the B/D regression. - Match poles by minimum total distance (Hungarian algorithm). - State the observed calibration in the documentation. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds opt-in uncertainty estimation to the time-domain
subspaceid, using the keyword convention of #214.Method
[U; Φ; Y]correspond to time instants. They are partitioned intonblockscontiguous blocks, andA,C,Kare re-estimated with one block of columns left out.B,Dare re-estimated by the regression infind_BDrestricted to the retained time instants (new optional argumentkeep).subspace_corewithout changes to the computation, so that it can be applied to column subsets.T = Or_b \ Or, whereOrandOr_bare the estimated extended observability matrices. Quantities that depend on the basis, such as the parameter covariance, are therefore expressed in the basis of the returned model.nx = :auto.Val(false)(default) returns the model only, unchanged. The frequency-domain method throws anArgumentErrorfor any other value.Fixes of existing behavior
find_PKdivided the residual cross product by a constant determined by the matrix dimensions instead of by the number of data-matrix columns, so the estimatedQ,R,SandPgrew linearly with the record length (for a trueR = 0.01:0.10, 0.40, 1.60atN = 1000, 4000, 16000; now0.0124, 0.0120, 0.0120).Kis unaffected, since the Riccati gain is invariant to a common scaling ofQ, R, S.stable = falsewas ignored; eigenvalue reflection of an unstableAwas always applied. The defaultstable = trueis unchanged.Robustness
unc.alignedrecords it.jackknife_cov(unc)then throws. Basis-invariant quantities (frequency response, poles) remain usable.TotalLeastSquares.wlswith aDiagonal) are restricted to the retained principal submatrix.pole_stdassigns poles by minimum total distance (Hungarian algorithm).Calibration
Monte Carlo comparison (fixed input, independent noise realizations, third-order system) of the RMS jackknife standard deviation with the standard deviation over realizations:
nblocksin 5–20 and to the weightingW.Other
ss.mdwith a magnitude plot with ±2σ band and pole standard deviations.stable = false, partition of the record, weight matrices, pole assignment against brute force, detection of unaligned replicates, equality with the default estimate, alignment of the replicates,Val(true),nx = :auto, allW,zeroD,focus = :simulation,scaleU = false, weights, MIMO, error cases, and a Monte Carlo calibration check (100 realizations).The output type of
subspaceidis not inferred, either with or without this change (find_PKreturnsP = I(n)in its fallback branch), so no inference test is added.Host: demeter2 · Session: f206e1d5-e03e-456f-aba8-1778b9dede55 · Working dir: ~/repos/CSI-subspace
🤖 Generated with Claude Code